
%{
#include <istream>
#include <iostream>
#include <deque>
#include "Parser.h"
#include "MosParser.h"

int lines_vb = 1;

extern std::istream *pInputFile;

extern std::string stringBuffer;
extern std::deque<std::string> strQueue;
extern std::deque<std::string> strStack;

#ifdef _MSC_VER

	#define YY_NEVER_INTERACTIVE 1

	extern "C" {
	int isatty(int fd) { return _isatty(fd); }
	int yywrap(void) { return 1; }
	}
#else
	extern "C" {
		int yywrap(void) { return 1; }
	}
#endif

#define YY_INPUT(buf,result,max_size) \
    { \
    result = pInputFile->read(buf, max_size).gcount(); \
    }

void yyerror(char *s)
{
  fprintf(stderr, "Error: %s at line:  col: \n",s);

}

/***




\\							{	BEGIN(INITIAL); return T_EOP; }

***/

%}

LineTerminator				\r|\n|\r\n
InputCharacter				[^\r\n]
WhiteSpace					{LineTerminator}|[ \t\f]

IntegerLiteral				0|[1-9][0-9]*
FloatLiteral				[0-9]*[.][0-9]+
StringLiteral				[_a-zA-Z][_0-9a-zA-Z]*

%%

{IntegerLiteral}			{ return T_LITERAL_INTEGER; }
{FloatLiteral}				{ return T_LITERAL_FLOAT; }


"Byte"						{ return T_TYPE_BYTE; }
"Char"						{ return T_TYPE_CHAR; }
"Int"						{ return T_TYPE_INT; }
"Float"						{ return T_TYPE_FLOAT; }

"::"						{ return T_COLONCOLON; }

"+"							{ return T_PLUS; }
"-"							{ return T_MINUS; }
"*"							{ return T_MUL; }
"/"							{ return T_DIV; }

"_"							{ return T_UNDERSCORE; }

"("							{ return T_LPAREN; }
")"							{ return T_RPAREN; }
"["							{ return T_LPAREN; }
"]"							{ return T_RPAREN; }

":"							{ return T_COLON; }
"="							{ return T_ASSIGN; }
","							{ return T_COMMA; }

{StringLiteral}				{ return T_IDENTIFIER; }

"\n"						{ lines_vb++; }

.							{}

%%
